<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>手机号码查询</title>
</head>

<body>
    <script>
        var x = prompt("请输入你的手机号码");
        alert(x.length);
        if (x.length == 11) {
            var y = parseInt(x);
            y = String(y);
            if(y.length==11)
                alert("号码正确");
            else
                alert("号码错误");
        }
        else
            alert("号码错误");


    </script>
</body>

</html>